<template>
  <div>
    <div id="myDiv" v-for="(val, index) in arr" :key="index">
      <input type="checkbox" v-model="check" :value="val" />
      <span>{{ val }}</span>
    </div>
    <p>你选择的数字累加起来的和是{{ count }}</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      check: [],
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
    };
  },
  computed: {
    count() {
      return this.check.reduce((sum, val) => (sum += val), 0);
    },
  },
};
</script>

<style>
#myDiv {
  display: inline-block;
}
</style>